#include "exttimer.h"
#include <osg/group>

namespace VrDataCore
{
	ExtTimer::ExtTimer(QObject *parent):QTimer(parent),_node(NULL)
		,_totalTime(0.0f),_actor(NULL)
	{}

	ExtTimer::~ExtTimer()
	{}

	void ExtTimer::setBindingNode(osg::Object* pnode)
	{
		_node = pnode;
	}

	void ExtTimer::timeOutNow()
	{
		_totalTime = _num;
		emit timeout();
	}

	void ExtTimer::setTimeOut(float num)
	{
		_num = num;
	}

	float ExtTimer::getTimerOut() const
	{
		return _num;
	}

	osg::Object* ExtTimer::getBindingNode() const
	{
		return _node;
	}

	void ExtTimer::addInterval()
	{
		_totalTime = _totalTime + interval();
	}

	float ExtTimer::getTotalTime() const
	{
		return _totalTime;
	}

	void ExtTimer::setBindingActor(CoreBase::ActorBase* proxy)
	{
		_actor = proxy;
	}

	CoreBase::ActorBase* ExtTimer::getBindingActor() const
	{
		return _actor;
	}

	void ExtTimer::setVec4Data(const osg::Vec4& color)
	{
		_vec4Data = color;
	}

	osg::Vec4 ExtTimer::getVec4Data() const
	{
		return _vec4Data;
	}

	void ExtTimer::setVec3Data(const osg::Vec3& data)
	{
		_vec3Data = data;
	}

	osg::Vec3 ExtTimer::getVec3Data() const
	{
		return _vec3Data;
	}

	void ExtTimer::startTimer()
	{
		_totalTime = 0.0f;
		start();
	}
}